#include "session/reuser/simple.h"

#include "service/service.h"

namespace OHOS {
namespace SmartServe {

Session* SimpleReuser::GetSession(EvalLLMTask* task)
{
    auto service = Service::Instance();
    auto& sessionMgr = service->sessionManager_;

    // 遍历查找现存 Session
    // TODO：匹配 pid 相同的 Session
    auto range = sessionMgr.allSessions_.equal_range(task->modelName_);
    for (auto it = range.first; it != range.second; ++it) {
        return it->second.get();
    }

    return nullptr;
}

} // namespace SmartServe
} // namespace OHOS